<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of EmpleadoDB
 *
 * @author Admin
 */
class Consulta1DB extends CI_Model {

    var $title = '';
    var $content = '';
    var $date = '';

    function __construct() {
        // Call the Model constructor
        parent::__construct();
    }

    function Consulta1($arrData) {

        //$query = $this->db->query(" SELECT cod_s, ficha, nombre, status, f_ing, f_egr FROM empleados WHERE status = $arrData['status'] AND cod_b = $arrData['cod_b'] ORDER BY cod_s");
        
        $query = $this->db
                ->select("cod_s, ficha, nombre, status, f_ing, f_egr")
                ->from("empleado")                
                ->where("status",$arrData['status'])
                ->where("cod_b",$arrData['cod_b'])                
                ->order_by("cod_s","desc")  
                ->get();
        
      
        
        //$queryresul = $this->db->query('SELECT * FROM "$query" UNION SELECT * FROM "$query2"');
               
        return $query->result();              
        
    }
        function Consulta1_1($arrData){
        
        
        $query2 = $this->db
                ->select("cod_s,n_emp")
                ->from("sucursal") 
                ->where("cod_b",$arrData['cod_b'])
                ->get();    

        return $query2->result();
        
        }
}
